﻿#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
#endregion

namespace BubbleSurvival
{
    /// <summary>
    /// The options screen is brought up over the top of the main menu
    /// screen, and gives the user a chance to configure the game
    /// in various hopefully useful ways.
    /// </summary>
    class GameOptionsMenuScreen : MenuScreen
    {
        #region Fields

        MenuEntry devUIMenuEntry;
        MenuEntry setDefaults;
        MenuEntry back;

        static bool devUI = true;
        public static bool DevUI
        {
            get { return devUI; }
        }

        #endregion

        #region Initialization


        /// <summary>
        /// Constructor.
        /// </summary>
        public GameOptionsMenuScreen()
            : base("Game Options")
        {

            // Create our menu entries.
            devUIMenuEntry = new MenuEntry(string.Empty);

            SetMenuEntryText();

            back = new MenuEntry("Back");
            setDefaults = new MenuEntry("Defaults");

            // Hook up menu event handlers.
            devUIMenuEntry.Selected += DevUIMenuEntrySelected;
            setDefaults.Selected += DefaultsMenuEntrySelected;
            back.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(devUIMenuEntry);
            MenuEntries.Add(setDefaults);
            MenuEntries.Add(back);
        }


        /// <summary>
        /// Fills in the latest values for the options screen menu text.
        /// </summary>
        void SetMenuEntryText()
        {
            devUIMenuEntry.Text = "Developer UI: " + (devUI ? "Show" : "Hide");
        }


        #endregion

        #region Handle Input

        /// <summary>
        /// Event handler for when the Developer User Interface menu entry is selected.
        /// </summary>
        void DevUIMenuEntrySelected(object sender, EventArgs e)
        {
            devUI = !devUI;

            SetMenuEntryText();
        }

        /// <summary>
        /// Event handler for when the Defaults menu entry is selected.
        /// </summary>
        void DefaultsMenuEntrySelected(object sender, EventArgs e)
        {
            devUI = true;

            SetMenuEntryText();
        }

        #endregion
    }
}